from django.contrib.auth.models import Permission
from django.contrib.auth.models import ContentType
'''
之前讲的权限是 是否能登陆后台管理系统

登录后台系统的用户，有不同的操作权限

权限体现在对模型的 增删改查
'''
from rest_framework.viewsets import ModelViewSet
from django.contrib.auth.models import Permission
from apps.meiduo_admin.serializers.permission import PermissionModelSerializer
from apps.meiduo_admin.utils import PageNum

class PermissionModelViewSet(ModelViewSet):
    # 查询所有的权限
    queryset = Permission.objects.all()

    serializer_class = PermissionModelSerializer
    # 设置分页
    pagination_class = PageNum


# 内容类型#############################
from django.contrib.auth.models import ContentType
from rest_framework.generics import ListAPIView
from apps.meiduo_admin.serializers.permission import ContentTypeModelSerializer

class ContentTypeListAPIView(ListAPIView):
    # 查询所有数据
    queryset = ContentType.objects.all()

    serializer_class = ContentTypeModelSerializer

    pagination_class = PageNum


